/*
 * KING.H Version 1.01 (C)1995,1996 HUDSON SOFT
 * HuC6272(KING)関連 Ｃコンパイラ用ヘッダーファイル(KING.H)
 */

#ifndef _KING_H_
#define _KING_H_

#include	<system.h>

/* register set macros */

#define _put_king_ar(x) __OUTPORTH(IO_KING_AR,x)

#define _get_king_sr() __INPORTH(IO_KING_SR)
#define _get_king_srl() __INPORTH(IO_KING_SRL)
#define _get_king_srh() __INPORTH(IO_KING_SRH)
#define _get_king_srw() __INPORTW(IO_KING_SR)

#define _put_king_dr(x) __OUTPORTH(IO_KING_DR,x)
#define _put_king_drl(x) __OUTPORTH(IO_KING_DRL,x)
#define _put_king_drh(x) __OUTPORTH(IO_KING_DRH,x)
#define _put_king_drw(x) __OUTPORTW(IO_KING_DR,x)

#define _get_king_dr() __INPORTH(IO_KING_DR)
#define _get_king_drl() __INPORTH(IO_KING_DRL)
#define _get_king_drh() __INPORTH(IO_KING_DRH)
#define _get_king_drw() __INPORTW(IO_KING_DR)

void init_king(void);

void set_kram_page(int fbno,int page);
/* 機能ブロックnoの定義 */
#define PAGE_SCSI 0
#define PAGE_BG 4
#define PAGE_KS 8
#define PAGE_KR 12
/* PAGEの定義 */
#define KRAM_PAGE0 0
#define KRAM_PAGE1 1

void set_kram_radr(u_long addr,int page,int iw);
void set_kram_wadr(u_long addr,int page,int iw);

u_long get_kram_cradr(void);
u_long get_kram_cwadr(void);

void write_kram_datas(u_short *sour,int len);
void read_kram_datas(u_short *dest,int len);

void fill_kram( int kvadrs, u_short value, int klength );
void fill_kramp( int kvadrs, u_short *ptbl, int klength );

void mram_to_kram( int kadrs, u_short *kdata, int klength );
void *kram_to_mram( int kadrs, u_short *kbuf, int klength );

#endif /* _KING_H_ */
